#ifndef MAINREACTOE_H
#define MAINREACTOE_H

#include "Poco/Runnable.h"
#include "Poco/SharedPtr.h"
#include "Poco/Net/ServerSocket.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Net/SocketNotification.h"

#include "./Common.h"

class ServerFactory;

namespace Reactor
{
	class MOUDLE_API MainReactor
	{
		struct MainReactorPrivate;
	public:
		MainReactor(std::shared_ptr<ServerFactory> serverFactory, const ServerOp& _serverop);
		virtual ~MainReactor();
		void prepareStop();
		void run();

	public:
		virtual void initheartbeatworker();
		virtual void initializeSubReactors();
		virtual void initializeAcceptor();
		virtual void startSubReactors();
		virtual void startHeartbeat();
		virtual void stopSubReactors();
		virtual void stopHeartbeat();
		virtual void destroy();

	protected:
		void stop();
		bool canstop();

	private:
		std::shared_ptr<MainReactorPrivate> d;
	};
}

#endif // !MAINREACTOE_H
